POV-Ray : Newsgroups : povray.programming : POV 4 Design Musings : POV 4 Design Musings Server Time
28 Jul 2024 22:26:41 EDT (-0400)
  POV 4 Design Musings  
From: Nigel Stewart
Date: 14 Apr 1999 03:45:50
Message: <371438B4.3D35341D@eisa.net.au>
These thoughts are provided merely as a point
of discussion.

Here are a few ideas about a C++ povray.
Basically, I think the biggest assets
in POV are the existing mathematics and
the scene description language.  While
I feel that general compatibility with
the scene description language should
be maintained, I think the parsing
should be re-designed.  Essentially,
I think that objects should know how
to parse themselves.  This could be
implemented by designing a "parsable"
interface for each derived object,
and adding a new plug-in is simply a
matter of compiling in the new class.
This drags in a few more ideas, like
giving each object in the system a
name, so that when the parser encounters
the string "sphere" it knows to 
construct a PovSphere object.  If the
parser encounters a "FunkyNewSphere"
string, but the class is not compiled
into the binary, it can simply ignore it.
(Perhaps issuing a warning)

Would anyone like to expand the design?

Summary
-------

Base Classes:

PovObject
PovParsable
PovPrimitive 
PovCamera
PovCanvas

Derived Classes:

PovSphere
PovBox
PovPlane
PovCsgUnion
PovCsgIntersection
PovCsgDifference

Detailed Information
--------------------

PovObject

  Generic base class for all POV objects.
  
  Methods:

    char *getObjectName()   "sphere" for example

    protected constructor: setObjectName(char *)

PovParsable (is a PovObject) 

  Abstract interface for Input/Output

  Methods:

    bool  supportsTextInput();
    bool  supportsTextOutput();
    bool  supportsBinaryInput();
    bool  supportsBinaryOutput();

    constructor from istream

    void  writeText(ostream &os);
    void  writeBinary(ostream &os);

    void  readText(istream &is);
    void  readBinary(istream &is);

PovPrimitive (is a PovParsable)

  Abstract interface for ray-tracable geometric object.

    bool intersectRay (double &t,        PovRay &ray);
    int  intersectsRay(vector<double> &t,PovRay &r);

    PovBoundingBox boundingBox();

PovCamera (is a PovParsable)

  Abstract interface for camera.  All cameras
  do is emit ray's.

    int  rays();
    Ray  ray(int x);

PovCanvas (is a PovParsable)

  Images are formed by painting the result of
  emitted camera rays onto a bitmap image.

    setCamera(PovCamera &camera)
    setFilename(char *filename)

    render();


-- 
Nigel Stewart (nig### [at] eisanetau)  http://www.eisa.net.au/~nigels/
Postgrad Research Student, RMIT University, Melbourne, Australia
All extremists should be taken out and shot.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.